using UnityEngine;

public class PlayerState
{
	protected PlayerStateMachine stateMachine;
	protected Player player;

	private string animBoolName;
	protected Vector2 MoveActionValue;

	protected float stateTimer;
	protected bool triggerCalled;
	public PlayerState(Player player, PlayerStateMachine stateMachine, string animBoolName)
	{
		this.player = player;
		this.stateMachine = stateMachine;
		this.animBoolName = animBoolName;
	}


	public virtual void Enter()
	{
		player.SetAnim(animBoolName, true);
		triggerCalled = false;
		if (player.debugState)
		{
			Debug.LogFormat("进入状态：{0}",this);
		}
		
	}

	public virtual void Exit()
	{
		player.SetAnim(animBoolName, false);

		if (player.debugState)
		{
			Debug.LogFormat("退出状态：{0}", this);
		}
	}

	public virtual void Update()
	{
		stateTimer -= Time.deltaTime;
		MoveActionValue = player.controller.GetMoveValue();
		player.SetAnim("yVelocity", player.movement.GetVelocity().y);
	}

	public virtual void AnimationFinishTrigger()
	{
		triggerCalled = true;
	}

}
